import facade
import pymysql
from xjlibrary.our_file_dir import BaseDir

curPath = BaseDir.get_file_dir_absolute(__file__)
configfile = BaseDir.get_new_path(curPath, "db.ini")


class DownIssue(object):
    def __init__(self):
        self.logger = facade.get_streamlogger()
        self.mysqlutil = facade.MysqlUtiles(configfile, "db", logger=self.logger)

    def sql(self):
        values = 'fd"fdedaddsdsjk'
        # print(values)
        # print(pymysql.escape_string(values))
        # sub_db_id = [values,values]
        # print(sub_db_id)
        # print([ids for ids in sub_db_id])
        # sub_db_ids = [pymysql.escape_string(ids) for ids in sub_db_id]
        # for ids in sub_db_ids:
        #     print(ids)
        # print("sub_db_id in %s AND" % str(tuple([pymysql.escape_string(ids) for ids in sub_db_id])))
        # values = pymysql.escape_string(values)
        sql = "insert ttt (abc) values ('{}')".format(values)
        sql = "select * from ttt where `abc`='{}'".format(values)
        print(sql)
        rows = self.mysqlutil.SelectFromDB(sql)
        print(rows[0][0])


DownIssue().sql()
